/**
 * 
 */
package com.xpec.c4.game.utility;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * 用 console 輸出執行時間 log
 * 
 * @author TW15010
 */
public class RunTimeTrackerConsole extends RunTimeTracker {
	private static final Log log = LogFactory.getLog(RunTimeTrackerConsole.class);

	/**
	 * log 輸出方式
	 */
	public enum LogOutputType {
		/** 使用 console 輸出 log */
		CONSOLE,
		
		CONSOLE_ERROR,

		/** 使用文字檔輸出 log */
		TEXT_FILE
	}

	private LogOutputType outputType;

	/**
	 * @param outputType
	 *            log 輸出方式
	 */
	public RunTimeTrackerConsole(LogOutputType outputType) {
		super();
		this.outputType = outputType;
	}

	@Override
	public void outputText(String logText) {
		switch (outputType) {
		case CONSOLE:
			System.out.println(logText);
			break;
		case CONSOLE_ERROR:
			System.err.println(logText);
			break;

		case TEXT_FILE:
			log.info(logText);
			break;
		}
	}
}
